line_list=[]#存储每一行的数据列表
with open("D:/1.txt","r",encoding="UTF-8") as f:
    line_list=f.readlines()
line_list=[item for item in line_list if "测试" not in item]
print("去除测试之后的列表内容",line_list)
#创建新的文件
with open("D:/bill.txt.bak","w",encoding="UTF-8") as f:
    for line in line_list:
        f.write(line)